/**
 * 
 */
package com.wskj.library.advice.controller;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;

import com.wskj.library.pojo.Advice;
import com.wskj.library.service.AdviceService;
import com.wskj.library.service.impl.AdviceServiceImpl;
import com.wskj.util.RequestUtil;

/**
 * @author 胡洋
 * @describe
 * @Date 2018年3月26日上午11:05:59
 * @version 1.0
 */
@WebServlet(urlPatterns = "/advice/add.do")
public class AddAdviceServlet extends HttpServlet {
    AdviceService service=new AdviceServiceImpl(); 
    
	
	protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
			throws javax.servlet.ServletException, java.io.IOException {
	  
	
		req.getRequestDispatcher("/WEB-INF/page/advice/add.jsp").forward(req, resp);
	};

	protected void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
			throws javax.servlet.ServletException, java.io.IOException {
	    Advice advice = RequestUtil.convertRequestToEntity(Advice.class, req);
	    boolean result = service.addAdvice(advice);
	    resp.sendRedirect(req.getContextPath()+"/advice/list.do");
	};
}
